/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 * */

// AmzServer - Tototoy's server model.
// Author: tonyjobmails@gmail.com (tonyhack).
//
// Define class TestThread.
//

#ifndef __TEST__THREAD__H
#define __TEST__THREAD__H

#include "common.h"
#include "thread.h"
#include "ring_queue_single_model_boundless.h"

namespace amz {

const uint32 kTestThreadUnitMaxSize = 1024 * 32;

static Mutex g_test_thread_mutex;

enum TestThreadType {
  TEST_THREAD_TYPE_CLIENT = 0,
  TEST_THREAD_TYPE_SERVER,
};

class TestThread : public Thread {
 public:
  TestThread(RingQueueInterface *communication, uint8 type, std::string name, bool joinable = false);
  virtual ~TestThread();
  
  virtual void Run();

  inline int GetTotal() const { return this->total_; }
  
 private:
  RingQueueInterface *communication_;
  bool type_;
  int total_;
};

}  // namespace amz

#endif  // __TEST__THREAD__H
